package sw6.lib.types;

import java.io.Serializable;

public class Interval implements Serializable, Comparable<Interval> {

	/**
	 * Interval class
	 */
	private static final long serialVersionUID = 1L;

	private int _from;
	private int _to;
	
	public Interval(int from, int to) {
		if(from > to) {
			from = to;
			to = from;
		}
		this._from 	= from;
		this._to 	= to;
	}
	
	public int getFrom() {
		return _from;
	}
	
	public int getTo() {
		return _to;
	}

	@Override
	public int compareTo(Interval anotherInterval) {
		if(this._from  == anotherInterval.getFrom() && this._to == anotherInterval.getTo()) {
			return 0;
		}
		else {
			return -1;
		}
	}
}
